package com.shard.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * @author: LCG
 * 作者: LCG
 * 日期: 2021/4/1  8:39
 * 描述:
 */
@Mapper
@Repository
public interface ShardMapper {


   @Insert("insert into tb_order(id,userId,createTime,orderName)values(#{id},#{userId},#{createTime},#{orderName})")
   public int addOne(Map<String,Object> map);

   @Select("select * from tb_order where orderName like CONCAT('%',#{orderName},'%')")
   public List<Map<String,Object>> getList(Map<String,Object> map);

   @Insert("insert into tb_order_item(id,orderId,userId,itemName)values(#{id},#{orderId},#{userId},#{itemName})")
   public int addItemOne(Map<String,Object> map);


   @Select("select tod.orderName,toi.itemName from tb_order tod inner join tb_order_item toi on tod.userId=toi.userId")
   public List<Map<String,Object>> getOrderItem();

}
